<template>
	<view class="main_bg">
		<app-header title="巡检详情"></app-header>
		<view class="card"  v-if="info.id">
			<view class="cell">
				<view class="label">状态：</view>
				<view class="value" :class="['inspection_status_'+info.inspection_status]">{{info.inspection_status_name}}</view>
			</view>
			<view class="line"></view>
			<view class="cell">
				<view class="label flex-c">
					巡检计划编号：
				</view>
				<view class="value">{{info.device_sns}}</view>
			</view>
			<view class="cell">
				<view class="label">巡检名称：</view>
				<view class="value">{{info.title}}</view>
			</view>
			<view class="cell">
				<view class="label">巡检对象：</view>
				<view class="value">{{info.shop_name_f}}</view>
			</view>
			<view class="cell">
				<view class="label">巡检地点：</view>
				<view class="value">{{info.address_f}} 
				
				</view>
			</view>
			<view class="cell">
				<view class="label">巡检设备：</view>
				<view class="value">{{info.device_name_f}}</view>
			</view>
			<view class="cell">
				<view class="label">预计巡检时间：</view>
				<view class="value">{{info.action_start}}至{{info.action_end}}</view>
			</view>
			<view class="cell">
				<view class="label">巡检人员：</view>
				<view class="value">{{info.name_f}}</view>
			</view>
			<view class="line"></view>
			<view class="cell">
				<view class="label">巡检反馈建议：</view>
			</view>
			<view class="textarea">
				{{info.member_describe}}
			</view>
			<view class="line"></view>
			<view class="cell">
				<view class="label">巡检图片</view>
			</view>
			<view class="upload">
				<view class="imgs_list flex-c" v-if="info.member_store_imgs_f&&info.member_store_imgs_f.length>0">
					<view class="imgs_son" v-for="(vo,idx) in info.member_store_imgs_f" :key="idx">
						<u-image :src="vo" mode="aspectFill" width="100px" height="100px"
							@click="$func.previewImage(vo,info.member_store_imgs_f)"></u-image>
					</view>
				</view>
			</view>
			<view class="line"></view>
			<view class="cell"  v-if="info.inspection_status==1">
				<view class="label">实际巡检时间：</view>
				<view class="value">{{info.dotime}}</view>
			</view>
		</view>

	</view>
</template>

<script>
	const systemInfo = uni.getSystemInfoSync();
	const safeArea = systemInfo.safeArea;
	export default {
		name: "deviceCard",

		data() {
			return {
				id: 0,
				info: {}
			};
		},
		computed: {
			scrollHeight() {
				return 'calc(100vh - 102rpx)'
			},
			imgCount() {
				return (imgs) => {
					const list = imgs ? imgs.split('|') : []
					return list.length
				}
			},
			imageList() {
				return (imgs) => {
					console.log(imgs)
					const list = imgs ? imgs.split('|') : []
					return list
				}
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getInfo()
		},
		methods: {
			setStatus(row) {
				uni.showModal({
					title: '提示',
					content: '确定结束吗？',
					confirmText: "确定",
					cancelText: "取消",
					success: (res) => {
						if (res.confirm) {
							this.$http.post('/data/api.auth.User/maintenanceHandle', {
								id: this.info.id,
							}).then(res => {
								this.getInfo()
							})
						} else if (res.cancel) {

						}
					}
				});

			},

			getInfo() {
				this.$http.post('/data/api.auth.User/maintenanceView', {
					id: this.id,
				}).then(res => {
					this.info = res.data
				}).catch(() => {

				})
			},

		}
	}
</script>

<style scoped lang="scss">
	.card {
		border-radius: 20px;
		background-color: #FFFFFF;
		margin: 20rpx;
		padding: 20rpx 30rpx;
	}

	.textarea {
		background-color: #F5F5F5;
		border-radius: 10rpx;
		padding: 20rpx;
	}

	.line {
		background-color: #E9E9E9;
		height: 1px;
		margin: 15rpx 0;
	}

	.icon {
		transition-duration: 0.3s;
		width: 40rpx;
		height: 40rpx;

		&.open {
			transform: rotate(180deg);
		}
	}

	.imgs_list {
		padding: 5px 0;
		justify-content: flex-start;

		.imgs_son {
			margin: 0 8px 0 0;
			border-radius: 4px;
			overflow: hidden;
		}
	}

	.cell {
		// height: 60rpx;

		.label {
			color: #333333;
		}

		.value {
			color: #ADADAD;
		}
	}

	.btn {
		width: 158rpx;
		height: 80rpx;
		background-color: #4F6FF6;

		border-radius: 10rpx;
		font-size: 30rpx;

		color: #FFFFFF;
		margin-left: 10rpx;
	}
</style>